package com.lu.controller;

import com.lu.dao.UserDao;
import com.lu.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;



@RestController
public class UserController {
    @Autowired
    private UserDao userDao;


    @GetMapping("/getUser")
    public List<User> getUser(){
        return userDao.getUser();
    }

    @GetMapping("/deleteUser/{id}")
    public int deleteUser(@PathVariable("id") int id){
        return userDao.deleteUser(id);
    }
    @GetMapping("/insertUser")
    public int insertUser( User user){
        return userDao.insertUser(user);
    }

    @GetMapping("/updateUser")
    public int updateUser(User user){
        return userDao.updateUser(user);
    }
}
